package com.qf.service.Impl;

import com.qf.mapper.LianheMapper;
import com.qf.pojo.Lianhe;
import com.qf.service.LianHeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class LianHeServiceImpl implements LianHeService {
    @Autowired
    private LianheMapper lianheMapper;


    @Override
    public List<Lianhe> findLianheRand() {
        List<Lianhe> lianheRand = lianheMapper.findLianheRand();
        return lianheRand;
    }

    @Override
    public List<Lianhe> findLianheByTypename(String typename) {
        List<Lianhe> lianheByTypename = lianheMapper.findLianheByTypename(typename);
        return lianheByTypename;
    }

    @Override
    public Lianhe findById(Integer lid) {

        Lianhe lianhe = lianheMapper.selectByPrimaryKey(lid);
        return lianhe;
    }

    @Override
    public void updatecontent(Lianhe lianhe) {
        lianheMapper.updateByPrimaryKey(lianhe);

    }

    @Override
    public void delcontent(Integer lid) {
        lianheMapper.deleteByPrimaryKey(lid);
    }

    @Override
    public void addcontent(Lianhe lianhe) {
        lianheMapper.insert(lianhe);

    }

    @Override
    public List<Lianhe> findAll(String lname) {
        List<Lianhe> all = lianheMapper.findAll(lname);

        return all;
    }

    @Override
    public List<Lianhe> findAlllianhe() {
        List<Lianhe> alllianhe = lianheMapper.findAlllianhe();
        return  alllianhe;
    }
}
